package com.wswy.wzcx.ui.data;

import com.blankj.utilcode.util.TimeUtils;
import com.google.gson.annotations.SerializedName;

import java.io.Serializable;

/**
 * Created by wangduheng26 on 2018/1/22.
 * wangduheng26@gmail.com
 */

public class UserMessage implements Serializable{

    @SerializedName("content")
    public String content;
//    @SerializedName("imgFiles")
//    public String[] imgFiles;
    @SerializedName("createTime")
    public long createTime;

    @SerializedName("fileUrl")
    public String image;

    @SerializedName("isAdmin")
    public boolean isAdmin;
    public Message convert(){
        Message message;
        if(isAdmin){
            message=new MessageAdmin();
        }else{
            message= new MessagePersion();
        }
        message.createTime=createTime;
        message.content=content;
        message.image = image;
        return message;
    }
    public static class Message implements Serializable{
        public String content;
        public String image;
        private long createTime;

        public void setCreateTime(long createTime) {
            this.createTime = createTime;
        }

        public String getCreateTimeStr() {
            return TimeUtils.millis2String(createTime*1000);
        }
    }
    public static class MessageAdmin extends Message implements Serializable{
    }
    public static class MessagePersion extends Message implements Serializable{
    }


}
